package com.njxzc.controller.before;


import com.njxzc.common.http.ResponseResult;
import com.njxzc.common.security.anno.AuthIgrone;
import com.njxzc.entity.CartEntity;
import com.njxzc.service.admin.GoodsService;
import com.njxzc.service.before.CartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/api/before/cart")
public class CartController {
    @Autowired
    private CartService cartService;
    @Autowired
    private GoodsService goodsService;

    @AuthIgrone
    @PostMapping("/add")
    public ResponseResult<Map<String,Object>> addCart(@RequestBody CartEntity cartEntity){
        return cartService.addCart(cartEntity);
    }
    @AuthIgrone
    @PostMapping("/bupDateCart")
    public ResponseResult<Map<String,Object>> bupdateDate(@RequestBody CartEntity cartEntity){
        return cartService.bupdate(cartEntity);
    }
    @AuthIgrone
    @PostMapping("/clear")
    public ResponseResult<Map<String,Object>> clearCart(@RequestBody CartEntity cartEntity){
        return cartService.clearCart(cartEntity);
    }
    @AuthIgrone
    @PostMapping("/remove")
    public ResponseResult<Map<String,Object>> removeCart(@RequestBody CartEntity cartEntity){
        return cartService.removeCart(cartEntity);
    }

}
